package com.pixpark.GPUPixelApp;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.media.ExifInterface;

import com.blankj.utilcode.util.LogUtils;

import java.io.IOException;

public class ExifReader {

    private static String TAG = "ExifReader";

    public static void readExif(String imagePath) {
        // 使用BitmapFactory获取Bitmap
//        Bitmap bitmap = BitmapFactory.decodeFile(imagePath);

        // 获取ExifInterface的实例
        ExifInterface exif = null;
        try {
            exif = new ExifInterface(imagePath);
        } catch (IOException e) {
            e.printStackTrace();
        }

        // 读取EXIF信息
        if (exif != null) {
            String model = exif.getAttribute(ExifInterface.TAG_MAKE);
            String make = exif.getAttribute(ExifInterface.TAG_MODEL);
            String orientation = exif.getAttribute(ExifInterface.TAG_ORIENTATION);

            // 打印读取的EXIF信息
            LogUtils.d(TAG,"Camera Model: " + model);
            LogUtils.d(TAG,"Camera Make: " + make);
            LogUtils.d(TAG,"Orientation: " + orientation);
        }
    }
}
